//
//  IPPlanDetialController.swift
//  IPlan
//
//  Created by robot on 3/24/16.
//  Copyright © 2016 codeFighter.com. All rights reserved.
//

import UIKit


 class IPPlanDetialController: UIViewController {

    var planContent = ""
    open func setMyTitle(myTilte:String) {
    
        planContent = myTilte
        
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()
        title = "计划详情"
        view.backgroundColor = UIColor.white
        // Do any additional setup after loading the view.
        setUpMainView()
        contentLabel.text = planContent
    
    }
    
    func setUpMainView() {
    
        self.view.addSubview(timeLabel)
        self.view.addSubview(contentTitle)
        self.view.addSubview(planLevel)
        self.view.addSubview(timeContent)
        self.view.addSubview(planStatus)
        self.view.addSubview(contentLabel)
        self.view.addSubview(deleteButton)
        addConstraints()
        
    }
    
    func addConstraints() -> Void {
    
        timeLabel.snp.makeConstraints { (make) in
            
            make.left.equalTo(15)
            make.top.equalTo(40 + 64)
            make.height.equalTo(20)
            make.width.equalTo(70)
            
        }
        
        timeContent.snp.makeConstraints { (make) in
            
            make.left.equalTo(timeLabel.snp.right).offset(15)
            make.top.equalTo(timeLabel.snp.top)
            
        }
        
        contentTitle.snp.makeConstraints { (make) in
            
            make.left.equalTo(timeLabel.snp.left)
            make.top.equalTo(timeLabel.snp.bottom).offset(20)
            make.height.equalTo(timeLabel.snp.height)
            make.width.equalTo(timeLabel.snp.width)
            
        }
        
        contentLabel.snp.makeConstraints { (make) in
            
            make.left.equalTo(contentTitle.snp.right).offset(10)
            make.right.equalTo(-15)
            make.top.equalTo(contentTitle.snp.bottom)
        }
        
        planLevel.snp.makeConstraints { (make) in
            
            make.left.equalTo(timeLabel.snp.left)
            make.top.equalTo(contentLabel.snp.bottom).offset(10)
            make.width.equalTo(timeLabel.snp.width)
            make.height.equalTo(timeLabel.snp.height)
            
        }
        
        planStatus.snp.makeConstraints { (make) in
            
            make.top.equalTo(planLevel.snp.top)
            make.bottom.equalTo(planLevel.snp.bottom)
            make.left.equalTo(planLevel.snp.right).offset(100)
            
        }
        
        deleteButton.snp.makeConstraints { (make) in
            
            make.left.equalTo(15)
            make.right.equalTo(-15)
            make.height.equalTo(44)
            make.bottom.equalTo(-7)
        }
        
    }
    
    lazy var timeLabel:UILabel = {
        
        let label = UILabel()
        label.font = UIFont.systemFont(ofSize: 14.0)
        label.textColor = UIColor.init(netHex: 0x666666)
        label.text = "计划时间:"
        return label
        
    }()
    
    lazy var timeContent:UILabel = {
    
        let content = UILabel()
        content.font = UIFont.systemFont(ofSize: 14.0)
        content.textColor = UIColor.init(netHex: 0x333333)
        content.text = "2016年5月16日 星期六"
        return content
    }()
    
    lazy var contentTitle:UILabel = {
    
        let label = UILabel()
        label.font = UIFont.systemFont(ofSize: 14.0)
        label.textColor = UIColor.init(netHex: 0x666666)
        label.text = "计划内容:"
        label.numberOfLines = 0
        return label
        
    }()
    
    
    lazy var contentLabel:UILabel = {
    
        let content = UILabel()
        content.font = UIFont.systemFont(ofSize: 15.0)
        content.textColor = UIColor.init(netHex: 0x333333)
        return content
    
    }()
    
    lazy var planLevel:UILabel = {
    
        let levelLabel = UILabel()
        levelLabel.font = UIFont.systemFont(ofSize: 14.0)
        levelLabel.textColor = UIColor.init(netHex: 0x666666)
        levelLabel.text = "计划等级:"
        return levelLabel
        
    }()
    
    lazy var planStatus:UILabel = {
    
        let statusLabel = UILabel()
        statusLabel.font = UIFont.systemFont(ofSize: 14.0)
        statusLabel.textColor = UIColor.init(netHex: 0x333333)
        statusLabel.text = "是否完成?"
        return statusLabel
        
    }()
    
    lazy var deleteButton:UIButton = {
    
        let button = UIButton.init(type: UIButtonType.custom)
        button.setTitle("删除", for: UIControlState.normal)
        button.backgroundColor = UIColor.init(netHex: 0xe42e51)
        button.layer.cornerRadius = 3.0
        button.clipsToBounds = true
        return button
    
    }()
    
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
    }
    */

}
